<template>
  <div class="mycount-current">
    <van-nav-bar
      title="手机号"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="mycount-current-view">
      <div class="mycount-current-view-text">当前手机号</div>
      <span>{{countPhone}}</span>
    </div>
    <div class="mycount-current-buttom" @click="$router.push('/myAcount/changePhone')">
      修改手机号
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      phone:''
    }
  },
  filters:{
    phoneFilter(value){
      let showPhone =  value.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")
      return showPhone
    },
  },
  computed:{
    countPhone(){
      if(this.phone==''){
        this.phone =  "无"
        return "无"
      }else {
        let showPhone =   this.phone.replace(/^(\d{3})\d{4}(\d+)/,"$1****$2")
        return showPhone
      }
    }
  },
  created(){
    this.phone = this.$store.state.userInfo.phone_number
  },
  methods:{
    onClickLeft() {
      this.$router.push('/privateInfo')
    },
  }
}
</script>

<style lang="less">
  .mycount-current{
    width: 100%;
    margin: 0 auto;
    text-align: center;
    .mycount-current-view{
      text-align: center;
      margin: 100px auto;
      width: 100%;
      height: 100px;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction:column;
      .mycount-current-view-text{
        margin: 15px auto;
        color: rgba(16, 16, 16, 100);
        font-size: 28px;
        text-align: left;
        font-family: PingFangSC-regular;
      }
      span {
        color: rgba(16, 16, 16, 100);
        font-size: 18px;
        text-align: left;
        font-family: PingFangSC-regular;
      }
    }
    .mycount-current-buttom{
      // display: flex;
      margin: 0 auto;
      width: 80%;
      height: 60px;
      text-align: center;
      line-height: 60px;
      border-radius: 24px;
      background-color: rgba(98, 166, 235, 100);
      color: rgba(255, 255, 255, 100);
      font-size: 20px;
      text-align: center;
      font-family: Microsoft Yahei;
    }
  }
.van-nav-bar__arrow {
    margin-right: 4px;
    font-size: 25px;
  }
  .van-nav-bar__title {
    max-width: 60%;
    margin: 0 auto;
    color: #323233;
    font-weight: 500;
    font-size: 20px;
  }
  .van-nav-bar .van-icon {
    color: #151515;
  }
</style>